Such a card has an integrated circuit that generally comprises a microprocessor, a volatile memory, and a non-volatile memory. The non-volatile memory contains personal data such as the identity of the person to whom the card has been issued, a secret identification code, banking information, etc. . . . , and at least one main program enabling information to be exchanged between the card and a reader of a terminal to which the card is connected, such as an automatic teller machine (ATM) or a payment terminal. The main program implements a plurality of nested functions serving in particular to communicate various items of personal data to the terminal, to retrieve a code input by the user to the terminal, to perform calculations on the code, e.g. for cryptographic or authentication purposes, to communicate the result of authentication to the terminal, . . . . These functions are nested in the sense that while a first function is being executed, it calls a second function which in turn, while it is being executed, calls a third function, etc. . . . ; the return of execution to the second function and then to the first function takes place in succession after the ends of execution of the third function and of the second function respectively. In order to allow return to the calling function, the microprocessor manages a function call stack that enables it to store a return address each time a function is called so that, at the end of execution of the called function, the microprocessor recovers the address stored in the function call stack and positions its execution pointer at that address so as to continue with execution of the calling function.
In such cards, one of the functions that is critical in terms of security consists in decrementing a counter on each failure of an authentication operation that consists in verifying that a code input to the terminal is indeed identical to the secret identification code stored in the integrated circuit of the card. With a bank card, this number of failures is generally set at three, while the code itself comprises four digits. The counter as decremented in this way is returned to its initial value after a successful verification of the code. In contrast, after three failures of code verification, the integrated circuit is blocked. There exists a fraudulent technique that consists in disturbing the operation of the card at the end of the authentication operation in order to prevent execution of the function that serves to decrement the counter. It can be understood that if that function is not performed, then a dishonest person can try out all possible combinations of four digits in order to find the correct combination.
Another fraudulent technique consists in disturbing the operation of the microprocessor so as to give rise to unexpected behaviors of the microprocessor, possibly making it possible to recover data that ought normally to be kept secret. For example, it is possible to envisage that after a function has been called by a calling function, execution may be returned to the calling function before the called function has come to the end of its execution.